<template>
    <div>
      
               <!--    查询功能-->
                 
                <div class="profiletwo" style="width: 600px;">
       <el-input style="width: 200px;" v-model="queryVo.value"
       @keyup.enter.native=" getfeedbackListhh()" ref="myInput"
       placeholder="请输入关键字搜索"></el-input>
         <el-button
            type="primary"
             style="margin-left: 5px; height: 31.5px"
            icon="el-icon-search"
            @click=" getfeedbackListhh()"
            >查询</el-button>
    
    </div>



        <!--    列表展示-->
        <el-table :data="feedbackData" :header-cell-style="{ background: '#D3D3D3FF', color: '#555555' }">
            <el-table-column prop="id" label="id" width="200" header-align="center"> </el-table-column>
            <el-table-column prop="name" label="用户名称" width="100">
            </el-table-column>
            <el-table-column label="反馈图" width="150" header-align="center">
                <template slot-scope="scope">
                    <el-image style="width: 150px; height: 50px" :src="scope.row.image" fit="contain"
                        :preview-src-list="[scope.row.image]"></el-image>
                      
                </template>
            </el-table-column>
            <el-table-column prop="content" label="反馈内容" width="200" header-align="center"></el-table-column>
            <el-table-column prop="clientName" label="客户端名称" width="80"></el-table-column>
            <el-table-column prop="gmtCreate" label="创建时间" width="140">
            </el-table-column>
            <el-table-column prop="operate" label="操作">
                <template slot-scope="scope">
                   
                    <el-popconfirm confirm-button-text="确定" cancel-button-text="取消" icon="el-icon-info" icon-color="red"
                        title="确定删除此反馈吗？" @confirm=" deleteFeedBackById(scope.row.id)" style="margin-left: 5px">
                        <el-button slot="reference" size="small" type="danger">删除</el-button>
                    </el-popconfirm>
                    
                </template>
            </el-table-column>
        </el-table>

        
       
      



           <!-- 分页  -->
        <div class="pagination-wrapper">
            <div class="pagination-container">
                <el-pagination @size-change="onSizeChange" @current-change="onCurrentChange"
                    :current-page="page" :page-sizes="[5, 10, 20, 30]" :page-size="5"
                    layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </div>
        </div>

        
    </div>
</template>

<script>
    import { deleteFeedBackById , getFeedBackList} from '@/api/feedbackService'
    export default {
      
        name: 'feedbackManagement',
        data() {
            return {


               
              
                id: '',
                queryVo:{
                   value: "",
                },
                page: 1,
               limit: 5,
                total: 0,
                feedbackData: [],
            }
        },
        methods: {



              // 改变每页显示数量
              onSizeChange(size) {
                this.feedbackDataData = [];
                this.limit = size;
                this.getFeedBackList();
            },
            // 改变当前页
            onCurrentChange(page) {
                this.feedbackData = [];
                this.page = page;
                this.getFeedBackList();
            },
            

            deleteFeedBackById(id) {
                deleteFeedBackById(id).then(res => {
                    if (res.code === 20000) {
                    this.$message({ 
                        message: "删除成功",
                        type: "success",
                    });
                    this.getFeedBackList()
                } else {
                    this.$message({
                        message: "删除失败",
                        type: "error",
                    });
                }
            },)},
          
            // 获取通知列表
            getfeedbackListhh(){
                this.page = 1;
                this. getFeedBackList()
            },

            getFeedBackList() {
                getFeedBackList(this.page, this.limit,this.queryVo).then(response => {
                    this.feedbackData = response.data.list.records;
                    this.total = response.data.list.total;
                    this.queryVo.value = "";
                });
            },

            resetData() {
                
            },

           
        },
        created() {
        this.getFeedBackList()
         },
        mounted() {
            this.$refs.myInput.focus();
    }}
               
</script>

<style>

   .center{
        display: flex;
   }

    .profiletwo {
        margin-left: 2px;
        margin-bottom: 5px;
        display: flex;
        width: 100%;
        background-color: #fff;
        color: #505050;
        font-size: 18px;
    }
</style>